//大作业H2

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0) {
    char arr[3];
    for (int i = 0; i < 3; i++) {
      arr[i] = Serial.read();
    }
    int a = atoi(arr);
    if (a != 0 && (a >= 1 || a <= 100)) {
      int value = 0;
      for (int j = 0; j <= a; j++) {
        value += j;
      }
      Serial.println(value);
    }
  } else {
    delay(1000);
  }
}
